package hfdp.chp07.chp0701;

import hfdp.chp07.chp0701.impl.MallardDuck;
import hfdp.chp07.chp0701.impl.TurkeyAdapter;
import hfdp.chp07.chp0701.impl.WildTurkey;
import hfdp.chp07.chp0701.service.Duck;

public class DuckTestDrive {
	
	static void testDuck(Duck duck) {
		duck.quack();
		duck.fly();
	}
	
	public static void main(String[] args) {
		MallardDuck duck = new MallardDuck();
		WildTurkey turkey = new WildTurkey();
		// wrap the turkey in a TurkeyAdapter, which makes it look like a Duck.
		Duck turkeyAdapter = new TurkeyAdapter(turkey);
		System.out.println("The Turkey says...");
		turkey.gobble();
		turkey.fly();
		System.out.println("\nThe Duck says...");
		testDuck(duck);
		System.out.println("\nThe TurkeyAdapter says...");
		testDuck(turkeyAdapter);
	}

}
